<template>
  <div id="app">
    <el-container>
      <!--aside左侧导航栏-->
      <el-aside width="200px">
        <el-menu :default-active="this.$route.meta.index"
                 background-color="#304156"
                 text-color="#fff"
                 active-text-color="#409EFF"
                 class="el-menu-vertical-demo"
                 @open="handleOpen"
                 @close="handleClose"
                 :collapse="isCollapse"
        >
          <!--商品管理-->
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span slot="title">商品管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="1-2">选项2</el-menu-item>
            </el-menu-item-group>
          </el-submenu>

          <router-link class="link" to="/friendlink">
            <el-menu-item index="3">
              <i class="el-icon-share"></i>
              <span slot="title">
                  友情链接
              </span>
            </el-menu-item>
          </router-link>

          <!--积分管理-->
          <router-link class="link" to="/jifen">
            <el-menu-item index="2">
              <i class="el-icon-s-claim"></i>
              <span slot="title">
                  积分管理
              </span>
            </el-menu-item>
          </router-link>

          <router-link class="endmyorder" to="/endmyorder">
            <el-menu-item index="4">
              <i class="el-icon-error"></i>
              <span slot="title">
                  结束订单
              </span>
            </el-menu-item>
          </router-link>

          <router-link class="addgoods" to="/addgoods">
            <el-menu-item index="5">
              <i class="el-icon-circle-plus"></i>
              <span slot="title">
                  商品添加
              </span>
            </el-menu-item>
          </router-link>

          <router-link class="duihuanGoods" to="/duihuanGoods">
            <el-menu-item index="6">
              <i class="el-icon-s-shop"></i>
              <span slot="title">
                  兑换商品
              </span>
            </el-menu-item>
          </router-link>

        </el-menu>
      </el-aside>
      <!--头部-->
      <el-container>
        <el-header>后台管理系统</el-header>
        <!--路由视图-->
        <el-main>
          <transition name="el-fade-in-linear" mode="out-in">
            <router-view></router-view>
          </transition>

        </el-main>

      </el-container>
    </el-container>
  </div>
</template>

<script>
  export default {
    name: 'App',
    data() {
      return {
        //点击下拉显示
        isCollapse: false
      }
    },
    methods: {
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      }
    }
  }
</script>

<style>
  .el-header {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
  }

  /*字体未选中*/
  .router-link {
    color: #fff;
  }

  /*字体选中*/
  .router-link-active {
    color: #409EFF;
  }

  .el-aside {
    color: #333;
    text-align: center;
    line-height: 200px;
    height: 100vh;
    background: rgb(48, 65, 86);
  }

  /*去除滚动条*/
  .el-aside::-webkit-scrollbar {
    display: none
  }

  .el-menu-item a {
    display: inline-block;
  }

  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: left;
  }

  body > .el-container {
    margin-bottom: 40px;
  }

  .el-menu {
    background: rgb(48, 65, 86);
    border: none;
  }

  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }

  .a {
    position: fixed;
    right: 20px;
    top: 50px;
    z-index: 99;
  }

</style>
